Skip to content

Add servers and sites API endpoints and let users use the API - #88

Merged
rimi-itk merged 7 commits into
developfrom
feature/user-api-key
Jul 6, 2026
Merged

Add servers and sites API endpoints and let users use the API#88
rimi-itk merged 7 commits into
developfrom
feature/user-api-key

Conversation

@rimi-itk

@rimi-itk rimi-itk commented Jul 2, 2026

Copy link
Copy Markdown
Contributor

Link to ticket

https://leantime.itkdev.dk/_#/tickets/showTicket/7910

Description

Adds API key to users and adds read-only endpoints for collections of servers and sites.

No GUI to set user API keys is added. It must be done using the app:user:set-api-key console command.

Screenshot of the result

If your change affects the user interface you should include a screenshot of the result with the pull request.

Checklist

  • My code is covered by test cases.
  • My code passes our test (all our tests).
  • My code passes our static analysis suite.
  • My code passes our continuous integration process.

If your code does not pass all the requirements on the checklist you have to add a comment explaining why this change
should be exempt from the list.

Additional comments or questions

If you have any further comments or questions for the reviewer please add them here.

@github-actions

github-actions Bot commented Jul 2, 2026

Copy link
Copy Markdown

API specification not up to date

The committed API specification files do not match the exported output.

Please run the following command, then commit and push the changes:

docker compose exec phpfpm composer update-api-spec

@codecov-commenter

codecov-commenter commented Jul 2, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 96.87500% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 37.63%. Comparing base (bae8493) to head (b89bc6d).
⚠️ Report is 1 commits behind head on develop.

Files with missing lines Patch % Lines
src/Command/UserSetApiKeyCommand.php 94.11% 1 Missing ⚠️
Additional details and impacted files
@@              Coverage Diff              @@
##             develop      #88      +/-   ##
=============================================
+ Coverage      37.14%   37.63%   +0.49%     
- Complexity       948      955       +7     
=============================================
  Files            133      135       +2     
  Lines           2972     2997      +25     
=============================================
+ Hits            1104     1128      +24     
- Misses          1868     1869       +1     
Flag Coverage Δ
unittests 37.63% <96.87%> (+0.49%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@rimi-itk
rimi-itk force-pushed the feature/user-api-key branch from 634acf1 to 554131d Compare July 2, 2026 13:54
@rimi-itk
rimi-itk force-pushed the feature/user-api-key branch from 9abdab9 to 94aa0ec Compare July 2, 2026 13:59
@github-actions

github-actions Bot commented Jul 2, 2026

Copy link
Copy Markdown

API Specification - Non-breaking changes

API Changelog 1.0.0 vs. 1.0.0

API Changes

GET /api/servers

  • endpoint added

GET /api/sites

  • endpoint added

@github-actions

github-actions Bot commented Jul 2, 2026

Copy link
Copy Markdown

API Specification - Non-breaking changes

API Changelog 1.0.0 vs. 1.0.0

API Changes

GET /api/servers

  • endpoint added

GET /api/sites

  • endpoint added

@rimi-itk rimi-itk changed the title Lets users use the API Let users use the API Jul 2, 2026
@rimi-itk
rimi-itk marked this pull request as ready for review July 2, 2026 14:30
@rimi-itk
rimi-itk requested a review from turegjorup July 2, 2026 14:30
@rimi-itk rimi-itk changed the title Let users use the API Add servers and sites API endpoints and let users use the API Jul 3, 2026
@github-actions

github-actions Bot commented Jul 3, 2026

Copy link
Copy Markdown

API Specification - Non-breaking changes

API Changelog 1.0.0 vs. 1.0.0

API Changes

GET /api/servers

  • endpoint added

GET /api/sites

  • endpoint added

@rimi-itk
rimi-itk merged commit 3ad5e54 into develop Jul 6, 2026
11 checks passed
@rimi-itk
rimi-itk deleted the feature/user-api-key branch July 6, 2026 12:49
turegjorup added a commit that referenced this pull request Jul 30, 2026
Version20260702123347 added user.api_key as NOT NULL and then put a unique
index on it, so every existing user got the same empty string and the index
collided on the second row. Any database holding more than one user failed
to migrate.

Generate a key for each existing user before creating the index, matching
App\Entity\User::__construct, which gives every user created since #88 a key
of its own. The keys come from PHP rather than SQL because they are
credentials and SQL's RAND() and UUID() are not cryptographically secure.
turegjorup added a commit that referenced this pull request Jul 30, 2026
Version20260702123347 added user.api_key as NOT NULL and then put a unique
index on it, so every existing user got the same empty string and the index
collided on the second row. Any database holding more than one user failed
to migrate.

Generate a key for each existing user before creating the index, matching
App\Entity\User::__construct, which gives every user created since #88 a key
of its own. The keys come from PHP rather than SQL because they are
credentials and SQL's RAND() and UUID() are not cryptographically secure.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants